<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>json操作</title>
</head>
<script>
    //声明 js 对象
    let obj = {"id":1, "username": "马资航", "address":"北京北科"};
    console.log(obj);
    //把js对象转换为json串
    let json = JSON.stringify(obj);
    console.log(json);


    let str = "{\"id\":1,\"username\":\"马资航\",\"address\":\"北京北科\"}"
    let j = JSON.parse(str);
    console.log(j);

</script>
<body>

</body>
</html>